#!/usr/bin/bash
set -e
mkdir -p /opt/tmp/

name="maven"
wget "http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz"
mkdir /opt/${name} && tar -zxvf apache-maven-3.5.2-bin.tar.gz -C  /opt/${name}  --strip-components 1
mv apache-maven-3.5.2-bin.tar.gz /opt/tmp
echo -e "export MAVEN_HOME=/opt/maven\nexport PATH=\$MAVEN_HOME/bin:\$PATH">>/etc/profile